import { createRouter, createWebHashHistory } from 'vue-router'

//导入组件
import video from './components/video/video.vue'
import videoinfo from './components/video/videoinfo.vue'
import videoorder from './components/video/videoorder.vue'

//创建路由实例
const router = createRouter({
    //路由被激活时，显示的样式，可以自定义一个样式
    linkActiveClass: 'router-active',

    history: createWebHashHistory(),
    routes: [{
        path: '/video', name: 'video', component: video,
        children: [
            {
                path: ':id',
                component: videoinfo,
                props: true,
                name: 'videoinfo',
                children: [
                    {
                        path: ':orderid',
                        component: videoorder,
                        props: true,
                        name: 'videoorder',
                    }
                ]
            },

        ]
    },
    ]
})

//懒加载的方式
//   const router = createRouter({
//     history: createWebHashHistory(),
//     routes: [
//       { path: '/home', component: () => import('./components/Home.vue') },
//       { path: '/about', component: () => import('./components/About.vue') },
//     ]
//   })


export default router;